<%@ page language="java" import="java.util.*,com.animal.dao.*,com.animal.bean.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>修改密码</title>

<link rel="stylesheet" type="text/css" href="./bootstrap/css/bootstrap.min.css">
<link href="./bootstrap/css/styles.css" rel="stylesheet">

</head>

<body>
	<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
		<div class="container-fluid">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#sidebar-collapse">
					<span class="sr-only">Toggle navigation</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="ExperimentalFileManager.html"><span>实验动物</span>档案管理</a>
				<ul class="user-menu">
					<li class="dropdown pull-right">
						<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-user"></span> User <span class="caret"></span></a>
						<ul class="dropdown-menu" role="menu">
							<li><a href="http://www.cau.edu.cn"><span class="glyphicon glyphicon-user"></span> Profile</a></li>
							<li><a href="#"><span class="glyphicon glyphicon-cog"></span> Settings</a></li>
							<li><a href="login.jsp"><span class="glyphicon glyphicon-log-out"></span> Logout</a></li>
						</ul>
					</li>
				</ul>
			</div>				
		</div>
	</nav>
		
	<div id="sidebar-collapse" class="col-sm-3 col-lg-2 sidebar">
		<form role="search">
			<div class="form-group">
				<input type="text" class="form-control" placeholder="Search">
			</div>
		</form>
		<ul class="nav menu">
			<li class="parent ">
				<a href="ExperimentalChangePassword.jsp">
					<span class="glyphicon glyphicon-list"></span> 管理员信息 <span data-toggle="collapse" href="#sub-item-1" class="icon pull-right"><em class="glyphicon glyphicon-s glyphicon-plus"></em></span> 
				</a>
				<ul class="children collapse" id="sub-item-1">
					<li>
						<a class="" href="ExperimentalPersonalInfo.jsp">
							<span class="glyphicon glyphicon-share-alt"></span> 个人信息
						</a>
					</li>
					<li>
						<a class="" href="ExperimentalChangePassword.jsp">
							<span class="glyphicon glyphicon-share-alt"></span> 修改密码
						</a>
					</li>
				</ul>
			</li>
			
			<li class="parent ">
				<a href="ExperimentalChangePassword.jsp">
					<span class="glyphicon glyphicon-list"></span> 实验档案管理 <span data-toggle="collapse" href="#sub-item-2" class="icon pull-right"><em class="glyphicon glyphicon-s glyphicon-plus"></em></span> 
				</a>
				<ul class="children collapse" id="sub-item-2">
					<li>
						<a class="" href="ExperimentalFileManagement.jsp">
							<span class="glyphicon glyphicon-share-alt"></span> 管理档案
						</a>
					</li>
					<!-- <li>
						<a class="" href="ExperimentalFileArchive.jsp">
							<span class="glyphicon glyphicon-share-alt"></span> 实验档案归档
						</a>
					</li> -->
				</ul>
			</li>
			
			<li role="presentation" class="divider"></li>
			<li><a href="login.jsp"><span class="glyphicon glyphicon-user"></span>登录页面</a></li>
		</ul>
		<div class="attribution">Created by <a href="#">软工第9组</a></div>
	</div><!--/.sidebar-->
		
	
	<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">			
		<div class="row">
			<ol class="breadcrumb">
				<li><a href="ExperimentalFileManager.html"><span class="glyphicon glyphicon-home"></span></a></li>
				<li class="active">管理员信息 > 修改密码</li>
			</ol>
		</div>	
		
		<!-- 从这开始添加代码 -->
		
		<div class="row">
			<div class="col-lg-12">
<!-- 				<h3><center><b>修改密码</b></center></h3> -->

<%
					
					//Cookie从LoginCheck.jsp中获取ID
 					String id=null;
   					Cookie[] cookies=request.getCookies();
   					for(int i=0;i<cookies.length;i++) {
   						if(cookies[i].getName().equals("id")) {
   							id=cookies[i].getValue();
   							break;
   						}
   					}
   					
   					//session从LoginCheck.jsp中获取ID
					//String id = (String)session.getAttribute("ID");
					
					ManagerBean manager = ManagerManage.selectByID(id);
				
%>

			<div class="row">
			<div class="col-md-4 col-md-offset-4">
			<div class="login-panel panel panel-default"  style="margin-top:50px;">
				<div class="panel-heading"><h3><center><b>修改密码</b></center></h3></div>
				<div class="panel-body">
					<form name="form2" method="post" action="UpdateServlet?do=changepassword">
						<fieldset>
							<div class="form-group">
								编号：<input class="form-control"  name="ID" type="text" value="<%=manager.getID() %>" readonly>
								<!-- <span class="help-block" style="color:red;">ID不能修改</span> -->
							</div>
							<div class="form-group">
								姓名：<input class="form-control" name="Name" type="text" value="<%=manager.getName() %>" readonly>
							</div>
							<div class="form-group">
								密码：<input class="form-control" name="oldPassword" type="text" value="<%=manager.getPassword() %>" readonly>
							</div>
							<div class="form-group">
								新密码：<input class="form-control" placeholder="请输入新密码" name="Password" type="text" value="" >
							</div>
							<br>
							<div class="form-group">
								<table width="350px"><tr><td>
									<input type="button" class="form-control btn btn-primary"  name="submit " value="修改"  onclick="dl();" style="width:50%;margin-left:25%;"/>
   									</td><td>
   									<input type="reset" class="form-control btn btn-primary"  name="reset" value="重置"  style="width:50%;margin-left:25%;"/>
									</td></tr>
								</table>
							</div>
						</fieldset>
					</form>
				</div>
			</div>
			</div>
			</div>
				
			</div>
		</div>
	</div>
	
	<script src="./bootstrap/js/jquery-3.1.0.min.js"></script>
	<script src="./bootstrap/js/bootstrap.min.js"></script>
	
<script>
	function dl()
	{
		if(form2.Password.value==null||form2.Password.value==""){
			alert("请输入新密码");
		}
		else{
			form2.submit();
	  	}
	}
	</script>

</body>

</html>
